/*@@

    Copyright (c) 2011 BlueSky LTD.  All rights reserved. 

    Created_datetime : 2011-1-11 15:30:37

    File Name :	base_os_win.inl

    Author : Wang Hu (ghoststears@gmail.com)

    Description : 

@@*/


#ifndef __BASE_OS_WIN_INL__
#define __BASE_OS_WIN_INL__


#include <Windows.h>


namespace BLK
{
    inline
    std::size_t list_dir(const std::string& path, std::vector<std::string>& files)
    {
        WIN32_FIND_DATA fd;
        
		std::string tempPath = path + "*";
        HANDLE hFind  = ::FindFirstFile (tempPath.c_str(), &fd);
        if (hFind  == INVALID_HANDLE_VALUE) 
        {
            return 0;
        }

        do
        {
            std::string name = fd.cFileName;

            if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
            {
                continue;
            }

            if (name  ==  "." &&  name == "..") 
            {
                continue;
            }

            files.push_back(name);

        } while (::FindNextFile(hFind,  &fd));

        ::FindClose (hFind);

        return files.size();
    }

    inline
    bool is_file(const std::string& path)
    {
        return true;
    }

    inline
    bool is_dir(const std::string& path)
    {
        return true;
    }
}





#endif /* __BASE_OS_WIN_INL__ */
